<template>
  <router-link :to="`/detail?id=${id}`" class="cate-itme" tag="div">
    <div class="cate-itme-img">
      <img :src="image" :alt="qunTitle">
      <!-- https://img.alicdn.com/bao/uploaded/i4/2200711151795/O1CN01hPHnpP1P89YiwKCXO_!!2200711151795-0-lubanu-s.jpg -->
    </div>
    <div v-if="type === 1">
      <p class="cate-itme-title">{{title}}</p>
      <p class="cate-itme-intro">
      <span>￥ <b>{{price}}</b></span>
      <span>销量: <b>{{saleNum}}</b></span>
      </p>
    </div>
  </router-link>
</template>

<script>
export default {
  name: 'Sycateitmes',
  props: ['id', 'title', 'price', 'saleNum', 'image', 'qunTitle', 'type']
}
</script>

<style lang="scss" scoped>
.cate-itme{
  width: 50%;
  box-sizing: border-box;
  padding: 5px;
  // border: 1px solid #95a5a6;
  border-radius: 5px;
  box-shadow: 0px 0px 3px #95a5a6;
  .cate-itme-img{
    width: 100%;
    margin-top: 5px;
    img{
      width: 100%;
      height: auto;
    }
  }
  .cate-itme-intro{
    display: flex;
    justify-content: space-between;
    b{
      color: #e74c3c;
    }
  }
  .cate-itme-title{
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }
}
</style>
